home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / wnos5src.zip / ENETDUMP.C < prev    next >
Text File  |  1992-04-12  |  844b  |  46 lines

  1. #include "global.h"
  2. #include "config.h"
  3. #ifdef ETHER
  4. #include "mbuf.h"
  5. #include "enet.h"
  6. #include "trace.h"
  7.  
  8. void
  9. ether_dump(fp,bpp,check)
  10. FILE *fp;
  11. struct mbuf **bpp;
  12. int check;    /* Not used */
  13. {
  14.     struct ether ehdr;
  15.     char s[20], d[20];
  16.  
  17.     ntohether(&ehdr,bpp);
  18.     trprintf(fp,"Ether: len %u %s->%s type ",
  19.         ETHERLEN + len_p(*bpp),pether(s,ehdr.source),pether(d,ehdr.dest));
  20.  
  21.     switch(ehdr.type){
  22.     case IP_TYPE:
  23.         trprintf(fp,"IP\n");
  24.         ip_dump(fp,bpp,1);
  25.         break;
  26.     case ARP_TYPE:
  27.     case REVARP_TYPE:
  28.         trprintf(fp,"%sARP\n",(ehdr.type == ARP_TYPE) ? "" : "REV");
  29.         arp_dump(fp,bpp);
  30.         break;
  31.     default:
  32.         trprintf(fp,"0x%x\n",ehdr.type);
  33.         break;
  34.     }
  35. }
  36.  
  37. int
  38. ether_forus(iface,bp)
  39. struct iface *iface;
  40. struct mbuf *bp;
  41. {
  42.     /* Just look at the multicast bit */
  43.     return (*bp->data & 1);
  44. }
  45.  
  46. #endif /* ETHER */